package pub.tbc.atps.task;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;

import java.util.Date;
import java.util.Map;

/**
 * 面向服务的任务，每个任务都是对某一个服务的调用 - HTTP服务
 *
 * @author tbc on 2016/11/13 1:26.
 */
@Data
public class RestTask {
    // 非空字符串
    private String requestId;
    // 非空字符串，包含http/ip/[port-def:80]/path
    private String url;
    // GET/POST/DELETE/PUT
    private String httpMethod;
    // 非空字符串
    private Map<String, Object> param;
    private String paramType;
    private Date timestamp;

    public String toJson() {
        return JSON.toJSONString(this, SerializerFeature.WriteMapNullValue);
    }
}
